package com.db.sboard;

import java.util.*;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

public class boardDAO {
	private SqlMapClientTemplate template;

	public void setTemplate(SqlMapClientTemplate template) {
		this.template = template;
	}

	public List<BoardVO> empAll() throws Exception {
		return template.queryForList("sboardList");

	}
	
	public List<BoardVO> getBoardListByType(int type){
		List<BoardVO> list = new ArrayList<BoardVO>();
		try {
			list = template.queryForList("sboardListByType", type);
		} catch (Exception e) {
			System.out.println("BoardDAO.getBoardListByType():"+e.toString());
		}
		return list;
	}
	
	// 게시판 분류
	public List<BoardTypeVO> getBoardTypeList(){
		List<BoardTypeVO> list = new ArrayList<BoardTypeVO>();
		try {
			list = template.queryForList("sbtListAll");
		} catch (Exception e) {
			System.out.println("BoardDAO.getBoardTypeList():"+e.toString());
		}
		return list;
	}
	public BoardTypeVO getBoardTypeContent(int type){
		BoardTypeVO btVO = new BoardTypeVO();
		try {
			btVO = (BoardTypeVO) template.queryForObject("sbtContent", type);
		} catch (Exception e) {
			System.out.println("BoardDAO.getBoardTypeContent():"+e.toString());
		}
		return btVO;
	}
}
